<?php
/**
 * @filename CaffeineBeverage.php
 * @author LD King
 * @encoding UTF-8
 * @date 2008-9-8 | 上午10:59:49
 * @package 08-Template
 * @subpackage 
 * @usage 模板模式
 * @note 
 * @copyright Copyright (c) 2007 - 2008 LD (http://mifunny.info)
 * @version $Id: $
 */

/**
 * 咖啡因饮料
 */
abstract class CaffeineBeverage {
	/**
	 * 煮饮料的过程
	 */
	public final function prepareRecipe() {
		 $this->boilWater();
		 $this->brew();
		 $this->pourInCup();
		 if ($this->customerWantsCondiments()) {
		 	$this->addCondiment();	
		 }
	}
	
	/**
	 * 冲泡饮料
	 *
	 */
	public abstract function brew();

	/**
	 * 添加调料
	 *
	 */
	public abstract function addCondiment();
	
	/**
	 * 煮开水
	 *
	 */
	public function boilWater() {
		echo "Boiling Water.<br />";
	}
	
	/**
	 * 装杯
	 *
	 */
	public function pourInCup() {
		echo "Pouring into cup.<br />";
	}
	
	/**
	 * 顾客需要调料吗？
	 * 
	 *@return boolean
	 */
	public function customerWantsCondiments() {
		return true;
	}
}
?>